package group2assignone.ucm;

import group2assignone.dao.*;
import group2assignone.view.MainView;
import group2assignone.view.manager.SalesReportView;

/**
 * Starts the flight booking program by opening up
 * the main view.
 * @author group2
 */
public class UCStartup implements UCController {

    private static UCStartup instance;
    private static MyDAO comms;
    private static ClientComms client;

    private UCStartup() {
    }

    public static UCStartup getInstance() {
        if (instance == null) {
            instance = new UCStartup();
        }
        return instance;
    }

    /**
     * creates an instance of the use case and runs it
     */
    public static void main(String[] args) {




        if (args.length == 0) {
            args = new String[1];
            args[0] = "MyAdmin";
        }
        if (args[0].equals("MyAdmin")) {
            comms = PhpAdminSQLDAO.getInstance();
        } else {
            comms = LocalSQLDAO.getInstance();
        }
        client = Client.getInstance();

        getInstance().run();
        
    }

    /**
     * Use Case: Start Program
     * 1. System creates and displays main UI
     */
    public void run() {
        MainView view = new MainView();
        view.go();
    }

    public MyDAO getDAO() {
        return comms;
    }

    public ClientComms getClientComms() {
        return client;
    }
}
